package com.heima.behavior.controller;

import com.heima.behavior.service.BehaviorService;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.ReadCountDto;
import com.heima.model.behavior.dtos.UnLikebehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.utils.common.AdminThreadLoacalUtil;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author earl
 * @Data 2024/8/21下午4:18
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/v1")
public class BehaviorController {
    private static final Logger log = LoggerFactory.getLogger(BehaviorController.class);
    @Autowired
    BehaviorService behaviorService;

    /**
     * 点赞和取消点赞接口
     * @param dto
     * @return
     */
    @PostMapping("/likes_behavior")
    public ResponseResult likesBehavior(@RequestBody LikesBehaviorDto dto){
        return behaviorService.likesBehavior(dto);
    }

    /**
     * 不喜欢和取消不喜欢接口
     * @param dto
     * @return
     */
    @PostMapping("/un_likes_behavior")
    public ResponseResult unLikeBehavior(@RequestBody UnLikebehaviorDto dto){
        return behaviorService.unLikeBehavior(dto);
    }

    /**
     * 阅读次数接口
     * @return
     */
    @PostMapping("/read_behavior")
    public ResponseResult readContent(@RequestBody ReadCountDto dto){
        return behaviorService.readContent(dto);
    }


}